package com.woniuxy.threeprojcet.end_water_project_admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniuxy.threeprojcet.end_water_project_admin.domain.User;
import com.woniuxy.threeprojcet.end_water_project_admin.dao.UserMapper;
import com.woniuxy.threeprojcet.end_water_project_admin.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author Lucas
 * @since 2021-08-26
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Resource
    private UserMapper userMapper;
    //获得用户表
    @Override
    public IPage getUser(IPage page) {

        QueryWrapper queryWrapper = new QueryWrapper();
//        List list = userMapper.selectList(queryWrapper);
        //倒序排序
        queryWrapper.orderByDesc("user_id");
        IPage iPage = userMapper.selectPage(page, queryWrapper);
        return iPage;
    }


    //修改用户状态
    @Override
    public int updateUserStateByWaterMeterId(int waterMeterId) {


        int i = userMapper.updateUserStateByWaterMeterId(waterMeterId);
        return i;
    }



}
